import VueRouter from 'vue-router';
import Home from '@/views/home/index';
import Login from '@/views/login/index';
import Register from '@/views/register/index';
import Search from '@/views/search/index';
import Detail from '@/views/detail';

export default new VueRouter({
    routes: [{
        path: '/home', component: Home, meta: {
            footerShow: true
        }
    }, {
        path: '/login', component: Login, meta: {
            footerShow: false
        }
    }, {
        path: '/register', component: Register, meta: {
            footerShow: false
        }
    }, {
        path: '/search/:keyword?', name: 'search', component: Search, meta: {
            footerShow: true
        }
    }, {
        path: '*', redirect: "/home"
    }, {
        path: '/detail/:id', component: Detail, name: 'detail', meta: {
            footerShow: true
        }
    },]
    ,scrollBehavior (to, from, savedPosition) {
        return {  y: 0 }
    }
})